package com.li.blog.handler;


import com.li.blog.vo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class AllExceptionHandler {


  /**
   * 全局异常抛出
   * @param ex
   * @return
   */
  @ExceptionHandler(Exception.class)
  @ResponseBody
  public Result doExpception(Exception ex){
    ex.printStackTrace();
    return Result.fail(-999,"系统异常");
  }


}
